package com.zgh.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zgh.domain.Bbs;
import com.zgh.domain.Blog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface BlogMapper extends BaseMapper<Blog> {
    @Select("select * from blog order by #{order} desc")
    List<Bbs> getAllBbsByTime(String order);

    @Update("update blog set thumbs = #{thumb} where id = #{blogId}")
    void thumb(String blogId, int thumb);

    @Select("select comments from blog where id = #{blogId}")
    int selectComments(String blogId);

    @Update("update blog set comments = #{comments} where id = #{blogId}")
    void updateComments(int comments,String blogId);
}
